package com.qianbei.common.utilis.img;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;

public class ClipView extends View
{
	public ClipView(Context context)
	{
		super(context);
	}

	public ClipView(Context context, AttributeSet attrs)
	{
		super(context, attrs);
	}


	public ClipView(Context context, AttributeSet attrs, int defStyle)
	{
		super(context, attrs, defStyle);
	}

	@Override
	protected void onDraw(Canvas canvas)
	{
		super.onDraw(canvas);
		int width = this.getWidth();
		int height = this.getHeight();
		
		Paint paint = new Paint();
		paint.setColor(0xaa000000);
//		paint.setColor(Color.WHITE);

		//top
//		canvas.drawRect(0, 0, width, height/3, paint);
		canvas.drawRect(0, 0, width, (height-width)/2, paint);
		//left
//		canvas.drawRect(0, height/3, (width - height/3)/2, height*2/3, paint);
		canvas.drawRect(0, (height-width)/2, 0, (height+width)/2, paint);
		//right
//		canvas.drawRect((width + height/3)/2, height/3, width ,  height*2/3, paint);
		canvas.drawRect(width, (height-width)/2, width ,  (height+width)/2, paint);
		//bottom
//		canvas.drawRect(0, height*2/3, width, height, paint);
		canvas.drawRect(0, (height+width)/2, width, height, paint);
		
		
		Paint paintBorder = new Paint();
		paintBorder.setColor(Color.WHITE);
		
		//top
		canvas.drawRect(1, (height-width)/2, width-1, (height-width)/2+1, paintBorder);
		//left
		canvas.drawRect(1, (height-width)/2, 2, (height+width)/2, paintBorder);
//		//right
		canvas.drawRect(width-2, (height-width)/2, width-1 ,  (height+width)/2, paintBorder);
//		//bottom
		canvas.drawRect(1, (height+width)/2-1, width-1, (height+width)/2, paintBorder);
		
		
	}
	
}
